package fr.insalyon.sims.broadcast.service;

import fr.insalyon.sims.streamManagerClient.Response;
import fr.insalyon.sims.streamManagerClient.Service;

abstract public class BroadcastService implements Service {
	// ------------------------------------------------------- CONSTANTS -- //
	// ------------------------------------------------------ ATTRIBUTES -- //
	// ---------------------------------------------------- CONSTRUCTORS -- //
	// --------------------------------------------------------- METHODS -- //
	// ------------------------------------------------- PRIVATE METHODS -- //

	protected Response getSuccessResponse() {
		return new Response(true);
	}
	
	protected Response getSuccessResponse(int port) {
		Response response = new Response(true);
		response.addResponseParameter("port", String.valueOf(port));
		return response;
	}
	
	protected Response getErrorResponse(int errorCode, String message) {
		Response response = new Response(false);
		response.setErrorCode(errorCode);
		response.setErrorDescription(message);
		//response.addResponseParameter("error", message);
		System.err.println("[" + getName() + "] " + message);
		return response;
	}
	
	// --------------------------------------------------- INNER CLASSES -- //
}
